#include <iostream>
#include "../Utils/File.hpp"
#include "JsonMap_rapidjson.h"
#include "JsonMapException.hpp"

using namespace std;
using namespace rapidjson;

int main()
{
    cout.setf(ios_base::boolalpha);

    try
    {
        std::list<int32_t> pose_list = std::initializer_list<int32_t>{1, 2, 3};

        sh::JsonMap data_map;
        data_map.put("robot_pose", pose_list);
        data_map.put("state", 0);
        cout << data_map.formatJson() << endl;

        sh::JsonMap body_map;
        body_map.put("data", data_map);
        cout << body_map.formatJson() << endl;
    }
    catch (sh::JsonMapException &exception)
    {
        cout << "json data error: " << exception.error().c_str() << endl;
    }
    cout << endl;

    return 0;
}
